function getvCode(obj){
	if(typeof(obj)!="object"){
		obj=$("#"+obj)
	}
	obj.attr("src",dir+"plus/verifycode.asp?n='+Math.random() onClick='this.src=dir+\"plus/verifycode.asp?n=\"+ Math.random();").show();
}

function showAsciiFilter(){
	var lt;
	for(i=65;i<=90;i++){
		lt=String.fromCharCode(i);
		document.write("<a href=\"showbrand.asp?letter="+lt+"\" rel=\""+lt+"\">"+lt+"</a>");
	}
}

function getFla(FlaSrc,width,height,wmode,FlashVars,insObj){
	var str;
	wmode=wmode||"transparent";
	FlashVars=FlashVars||"";
	str="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" width=\""+width+"\" height=\""+height+"\">";
	str+="  <param name=\"movie\" value=\""+FlaSrc+"\" />";
	str+="  <param name=\"quality\" value=\"high\" />";
	str+="  <param name=\"wmode\" value=\""+wmode+"\" />";
	str+="	<param name=\"FlashVars\" value=\""+FlashVars+"\" />";
	str+="  <embed src=\""+FlaSrc+"\" quality=\"high\" wmode=\""+wmode+"\" FlashVars=\""+FlashVars+"\"  pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\"></embed>";
	str+="</object>";
	if(insObj){
		$(insObj).html(str);
	}else{
		document.write(str);
	}
}


//改变图片大小
function resizepic(thispic){ 
	if(thispic.width>400) thispic.width=400; 
}

//无级缩放图片大小
function bbimg(o){
	return
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=event.wheelDelta/12;
	if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}

function request(ele){
	var pars=location.search;
	var pos=pars.indexOf('?');
	if(pos==-1){
		return "";
	}else{
		pars=pars.substring(pos+1);
	}
	var ps=pars.split("&");
	var args=new Object();
	var temp;
	var name,value,index;
	for(var i=0;i<ps.length;i++){
		temp=ps[i]; 
		index=temp.indexOf("=");
		if(index==-1) continue;
		name=temp.substring(0,index);
		value=temp.substring(index+1);
		args[name]=value;
	}
	
	if(args[ele]!=undefined){
		return args[ele];	
	}else{
		return "";
	}
}

function show_time(param){
	param=param||new Object();
	param.obj=param.obj||"";
	param.fmt=param.fmt||"";
	function get_new_time(){
		var s,Y,M,M1,D,D1,hh,hh1,mm,mm1,ss,ss1,week;
		var weekdays=["日","一","二","三","四","五","六"]
		var time=new Date();
		Y=time.getFullYear();
		M=time.getMonth()+1;
		D=time.getDate();
		hh=time.getHours();
		mm=time.getMinutes();
		ss=time.getSeconds();
		week=time.getDay();
		M<10?M1="0"+M:M1=M;
		D<10?D1="0"+D:D1=D;
		hh<10?hh1="0"+hh:hh1=hh;
		mm<10?mm1="0"+mm:mm1=mm;
		ss<10?ss1="0"+ss:ss1=ss;
		if(param.fmt==""){
			s=Y+"年"+M1+"月"+D1+"日&nbsp;"+hh1+":"+mm1+":"+ss1;
		}else{
			s=param.fmt;
			s=s.replace("YYYY",Y);
			s=s.replace("MM",M1);
			s=s.replace("M",M);
			s=s.replace("DD",D1);
			s=s.replace("D",D);
			s=s.replace("hh",hh1);
			s=s.replace("h",hh);
			s=s.replace("mm",mm1);
			s=s.replace("m",mm);
			s=s.replace("ss",ss1);
			s=s.replace("s",ss);
			s=s.replace("week",week);
			s=s.replace("WEEK",weekdays[week]);
		}
		$(param.obj).each(function(){$(this).html(s)})
	}
	setInterval(get_new_time,1000);
}

var Fav={
	AddFavorite : function(){
		var sURL=location.href;
		var sTitle=document.title;
		try{
			window.external.addFavorite(sURL, sTitle);
		}catch (e){
			try{
				window.sidebar.addPanel(sTitle, sURL, "");
			}catch (e){
				alert("加入收藏失败，请使用Ctrl+D进行添加");
			}
		}
	},
	SetHome : function(obj){
		var URL='http://'+location.hostname+(location.port!=''?':':'')+location.port;
		try{
			obj.style.behavior='url(#default#homepage)';obj.setHomePage(URL);
		}
		catch(e){
			if(window.netscape){
				try{
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
				}catch (e){ 
					alert("此操作被浏览器拒绝！");  
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',URL);
			}else{  
            alert("抱歉，您所使用的浏览器无法完成此操作。/n/n您需要手动将'"+URL+"'设置为首页。");  
        	} 
		}
	}
}

function showtab(tabs,tab_conts,more){
	if(tabs.length>0){
		tabs.each(function(n){
			$(this)	.hover(function(){
				show_tab(n);
			});
		});
		show_tab(0);
	}
	function show_tab(i){
		var tab=tabs.eq(i)
		tabs.removeClass("hover");
		tab_conts.hide();
		tab.addClass("hover");
		tab_conts.eq(i).show();
		if(more){
			more.attr("href",tab.attr("href"));
		}
	}

}

function loadScript(jsfile){
	$("<script></"+"script>").attr({src:jsfile,type:"text/javascript"}).appendTo($("head"));
}

var timeout         = 200;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 